// 直接传背景图片,生成带背景的svg容器
// svg-elem(0)  

// 指定大小生成不带背景的svg容器
// svg-elem({width, height, overflow}) 

mixin svg-elem(...arg)
  -var width = 0
  -var height = 0
  -url = ''

  -var style = `display:inline;background-size:cover;background-repeat:no-repeat;display:inline;line-height:0;`

  // -console.log(arg.length, 'svg-elem.pug')
  if arg == 1 && Number.isInteger(arg[0])
    -width = images[arg[0]].width
    -height = images[arg[0]].height
    -url = images[arg[0]].url
    -style += `background-image:url(${url}`
  else if typeof params === 'object'
    -width = params.width
    -height = params.height
    -var overflow = params
  else 
    -width = images[arg[0]].width
    for i in arg
      // -console.log(i, arg[i], 'svg-elem.pug =========')
      -height += images[i].height
    -style = `transform:rotateX(0);max-width:none!important;pointer-events:none`

    // -console.log({width, height, url}, 'svg-elem.pug')
  
  svg(
    data-info="调试参数", opacity="1",
    style=`${style + (overflow ? ';overflow:' + overflow + ';' : '')}`, 
    viewBox=`0 0 ${width} ${height}`, 
    xmlns=`http://www.w3.org/2000/svg`, 
    xlink=`http://www.w3.org/1999/xlink`)
    block
